﻿//using System;
//using System.Collections.Generic;
//using System.ServiceModel;
//using System.ServiceModel.Description;
//using System.ServiceModel.Discovery;

//namespace EasyComm.Hosting.Configuration
//{
//    internal static class ProxyConfiguration
//    {
//        internal static void ApplyConfiguration(ServiceHost serviceHost, Type serviceType, Uri[] baseAddresses, IDictionary<string, ContractDescription> implementedContracts)
//        {
//            if (serviceHost == null)
//            {
//                return;
//            }

//            #region main endpoints
//            for (int i = 0; i < baseAddresses.Length; i++)
//            {
//                DiscoveryEndpoint mainEndPoint = new DiscoveryEndpoint(GenericConfiguration.GetMainBinding(), new EndpointAddress(baseAddresses[i]));
//                mainEndPoint.Name = string.Format("{0}_MainEndpoint_{1}", serviceType.Name, i);
//                mainEndPoint.IsSystemEndpoint = false;
//                serviceHost.AddServiceEndpoint(mainEndPoint);

//                //foreach (KeyValuePair<string, ContractDescription> contractDesc in implementedContracts)
//                //{
//                //    //ContractDescription desc = GenericConfiguration.CreateContractDescription(serviceType, contractType, ns, contractAlreadyImplemented);
//                //}
//            }
//            #endregion

//            // ** DISCOVERY ** //
//            ServiceDiscoveryBehavior discoveryBehavior = new ServiceDiscoveryBehavior();
//            discoveryBehavior.AnnouncementEndpoints.Add(new UdpAnnouncementEndpoint());
//            serviceHost.Description.Behaviors.Add(discoveryBehavior);
//            serviceHost.AddServiceEndpoint(new UdpDiscoveryEndpoint() { Name = "udpDiscoveryEndPoint" });

//            GenericConfiguration.SetupMex(serviceHost, serviceType, "proxyMexUrl");
//            GenericConfiguration.SetupDebugging(serviceHost);
//            //System.ServiceModel.ServiceHostingEnvironment.MultipleSiteBindingsEnabled = true;
//        }
//    }
//}
